home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-07-15 | 11.5 KB | 276 lines | [TEXT/MPS ] |
- //----------------------------------------------------------------------------------------
- // UTwistDownDocument.h
- // ETO20 MacApp 3.3.1, MPW 3.4.1
- // Copyright ©1994-1996 Conrad Kopala
- // Twist Down Lists version 2.0a0 7/15/96
- //----------------------------------------------------------------------------------------
-
- #ifndef __UTWISTDOWNDOCUMENT__
- #define __UTWISTDOWNDOCUMENT__
-
- #ifndef __UVOLUME__
- #include "UVolume.h"
- #endif
-
- //Required to get ESearchMethod
- #ifndef __UTWISTDOWNGLOBALS__
- #include "UTwistDownGlobals.h"
- #endif
-
- //MacApp stuff
- #ifndef __UDOCUMENT__
- #include "UDocument.h"
- #endif
-
- //ToolBox stuff
- //None
-
- //ANSI stuff
- //None
- //----------------------------------------------------------------------------------------
- // Constants
- //----------------------------------------------------------------------------------------
-
- //----------------------------------------------------------------------------------------
- // Externals
- //----------------------------------------------------------------------------------------
-
- class TTwistDownApp; //external
- class TTwistDownView; //external
- class TTwistDownElement; //external
- class TTwistDownControl; //external
- class TProgressBarIndicator; //external
- class TTwistDownDocument; //forward
-
- //----------------------------------------------------------------------------------------
- // TExpandAllCommand
- //----------------------------------------------------------------------------------------
- class TExpandAllCommand: public TServerCommand
- {
- MA_DECLARE_CLASS;
-
- public:
- TTwistDownView* fTwistDownView;
- TTwistDownDocument* fTwistDownDocument;
- //The following two fields will be used for error recovery.
- long fOldNumberOfExpandedControls;
- long fOldNumberOfCollapsedControls;
-
- TExpandAllCommand::TExpandAllCommand();
- virtual ~TExpandAllCommand();
-
- void TExpandAllCommand::IExpandAllCommand(TTwistDownDocument* twistDownDocument, TCommandHandler* itsContext);
- void TExpandAllCommand::IExpandAllCommand(TTwistDownDocument* twistDownDocument, TCommandHandler* itsContext,
- const AppleEvent& itsMessage, const AppleEvent& itsReply);
- virtual TAppleEvent* TExpandAllCommand::MakeAppleEvent();
- virtual void TExpandAllCommand::DoIt();
- };
- //----------------------------------------------------------------------------------------
- // TCollapseAllCommand
- //----------------------------------------------------------------------------------------
- class TCollapseAllCommand: public TServerCommand
- {
- MA_DECLARE_CLASS;
-
- public:
- TTwistDownView* fTwistDownView;
- TTwistDownDocument* fTwistDownDocument;
-
- TCollapseAllCommand::TCollapseAllCommand();
- virtual ~TCollapseAllCommand();
-
- void TCollapseAllCommand::ICollapseAllCommand(TTwistDownDocument* twistDownDocument, TCommandHandler* itsContext);
- void TCollapseAllCommand::ICollapseAllCommand(TTwistDownDocument* twistDownDocument, TCommandHandler* itsContext,
- const AppleEvent& itsMessage, const AppleEvent& itsReply);
- virtual TAppleEvent* TCollapseAllCommand::MakeAppleEvent();
- virtual void TCollapseAllCommand::DoIt();
- };
- //----------------------------------------------------------------------------------------
- // TExpandElementCommand
- //----------------------------------------------------------------------------------------
- class TExpandElementCommand: public TServerCommand
- {
- MA_DECLARE_CLASS;
-
- public:
- TTwistDownDocument* fTwistDownDocument;
- TTwistDownView* fTwistDownView;
- TTwistDownElement* fElementToExpand;
-
- //The following two fields will be used for error recovery.
- long fOldNumberOfExpandedControls;
- long fOldNumberOfCollapsedControls;
-
- TExpandElementCommand::TExpandElementCommand();
- virtual ~TExpandElementCommand();
- void TExpandElementCommand::IExpandElementCommand(TTwistDownDocument* twistDownDocument,
- TTwistDownElement* elementToExpand);
- void TExpandElementCommand::IExpandElementCommand(TTwistDownDocument* twistDownDocument,
- TTwistDownElement* elementToExpand, const AppleEvent& itsMessage,
- const AppleEvent& itsReply);
- virtual TAppleEvent* TExpandElementCommand::MakeAppleEvent();
- virtual void TExpandElementCommand::DoIt();
- };
- //----------------------------------------------------------------------------------------
- // TCollapseElementCommand
- //----------------------------------------------------------------------------------------
- class TCollapseElementCommand: public TServerCommand
- {
- MA_DECLARE_CLASS;
-
- public:
- TTwistDownDocument* fTwistDownDocument;
- TTwistDownView* fTwistDownView;
- TTwistDownElement* fElementToCollapse;
-
- TCollapseElementCommand::TCollapseElementCommand();
- virtual ~TCollapseElementCommand();
- void TCollapseElementCommand::ICollapseElementCommand(TTwistDownDocument* twistDownDocument,
- TTwistDownElement* elementToCollapse);
- void TCollapseElementCommand::ICollapseElementCommand(TTwistDownDocument* twistDownDocument,
- TTwistDownElement* elementToCollapse, const AppleEvent& itsMessage,
- const AppleEvent& itsReply);
- virtual TAppleEvent* TCollapseElementCommand::MakeAppleEvent();
- virtual void TCollapseElementCommand::DoIt();
-
- };
- //----------------------------------------------------------------------------------------
- // TTwistDownDocument
- //----------------------------------------------------------------------------------------
- class TTwistDownDocument: public TDocument
- {
- MA_DECLARE_CLASS;
-
- public:
- TVolume* fVolume;
- short fVolumeRefNumber;
- CStr31 fVolumeName;
- short fSameVolumeNumber; //Used by TTwistDownApp::GetNextDocumentNumber to make
- //sure document numbers aren't duplicated.
- Boolean fShowInvisibleFiles;
- Boolean fEnableProgressIndicatorStop;
-
- TSimpleDependencySpace* fDependencies;
-
- long fNumberOfDirectoriesToLoad;
- long fNumberOfFilesToLoad;
- long fNumberOfItemsToLoad;
-
- // The user can stop loading the list early. I want to know how many of each kind of thing
- // are actually in the list. The following three fields are used to keep count of the number
- // of things of each kind that are actually in the list. The three previous fields could have been
- // recycled but, I think this is clearer and I want to be able to read this code a year from now
- // without having to spend anymore time figuring it out than is necessary.
- long fNumberOfDirectoriesInList;
- long fNumberOfFilesInList;
- long fNumberOfItemsInList;
-
- TTwistDownView* fTwistDownView;
- TTwistDownElement* fHeadOfListElement;
- TextStyle fTextStyle;
-
- TProgressBarIndicator* fProgressBarIndicator;
- long fUpdateAmount;
- long fProgressUpdateCounter;
-
- ESearchMethod fSearchMethod;
-
- TTwistDownDocument::TTwistDownDocument();
- virtual ~TTwistDownDocument();
-
- void TTwistDownDocument::ITwistDownDocument(TVolume* itsVolume, Boolean showInvisibleFiles);
-
- virtual void TTwistDownDocument::CloseAndFree();
-
- virtual TDependencySpace* TTwistDownDocument::GetDependencySpace();
- virtual void TTwistDownDocument::Changed(ChangeID theChange, TObject* changedBy);
-
- Boolean TTwistDownDocument::FindDocument(TVolume* aVolume);
- void TTwistDownDocument::SetVolumeData(short volumeRefNumber, CStr31 volumeName);
- void TTwistDownDocument::SetUpdateAmountTo(long updateAmount);
-
- virtual void TTwistDownDocument::FreeData();
- void TTwistDownDocument::FreeTwistDownList(TTwistDownElement* twistDownElement);
-
- virtual void TTwistDownDocument::DoMakeViews(Boolean forPrinting);
- void TTwistDownDocument::AddPrintHandlerToView(TView* aView);
-
- virtual void TTwistDownDocument::DoSetupMenus();
-
- virtual void TTwistDownDocument::ReadDocument(Boolean forPrinting); //overloaded
- virtual void TTwistDownDocument::DoPostMakeViews(Boolean forPrinting);
-
- TTwistDownElement* TTwistDownDocument::BuildTwistDownList(short indentLevel,
- long volumeDirIndex, OSErr& myOSErr);
-
- TTwistDownElement* TTwistDownDocument::MakeTwistDownElement(TTwistDownElement* previousElement,short indentLevel,
- CStr63 displayedText, OSErr& myOSErr);
-
- void TTwistDownDocument::DisposeTwistDownElement(TTwistDownElement* twistDownElement);
-
- //CountVisibleElements counts all twistDownElements in the visible list (ie. fShowSubList == TRUE).
- //That includes both successor and descendant elements. Usually, fHeadOfListElement is
- //passed to CountVisibleElements. Be sure you really want to start counting with some other element.
- long TTwistDownDocument::CountVisibleElements(TTwistDownElement* twistDownElement);
-
- void TTwistDownDocument::GetTwistDownElementAt(short anItem, TTwistDownElement* startingTwistDownElement,
- TTwistDownElement** currentTwistDownElement, short &rowNumber);
-
- void TTwistDownDocument::GetTwistDownElementRowNumber(TTwistDownElement* startingTwistDownElement,
- TTwistDownElement* targetTwistDownElement,
- TTwistDownElement** currentTwistDownElement, short &rowNumber);
-
- TTwistDownElement* TTwistDownDocument::GetHeadOfList();
-
- void TTwistDownDocument::ExpandElement(TTwistDownElement* twistDownElementToExpand);
- void TTwistDownDocument::CollapseElement(TTwistDownElement* twistDownElementToCollapse);
-
- void TTwistDownDocument::SetShowSubListFlags(TTwistDownElement* twistDownElement);
- void TTwistDownDocument::ClearShowSubListFlags(TTwistDownElement* twistDownElement);
- void TTwistDownDocument::RestoreShowSubListFlags(TTwistDownElement* twistDownElement);
-
- void TTwistDownDocument::CollapseAll();
-
- void TTwistDownDocument::InstallTextStyle(const TextStyle& itsTextStyle);
- void TTwistDownDocument::UpdateTwistDownElements(TTwistDownElement* twistDownElement, short &rowNumber);
- void TTwistDownDocument::CalculateColWidthParams(TTwistDownElement* twistDownElement, short& maxIndentLevel,
- short& maxTextWidth);
-
- void TTwistDownDocument::IncrementItemsInList();
- void TTwistDownDocument::DecrementItemsInList();
-
- long TTwistDownDocument::GetNumberOfDirectoriesInList();
- long TTwistDownDocument::GetNumberOfItemsInList();
-
- //Scripting Support
- virtual void TTwistDownDocument::DoScriptCommand(CommandNumber aCommandNumber,TAppleEvent* message,TAppleEvent* reply);
- void TTwistDownDocument::GetTwistDownElementByName(TTwistDownElement* startingTwistDownElement,
- TTwistDownElement** currentTwistDownElement, CStr63 &theName, Boolean &foundIt);
-
- void TTwistDownDocument::GetTwistDownElementByIndex(short desiredIndex, TTwistDownElement* startingTwistDownElement,
- TTwistDownElement** currentTwistDownElement, short &elementCounter);
-
- void TTwistDownDocument::GetVisibleTwistDownElementByName(TTwistDownElement* startingTwistDownElement,
- TTwistDownElement** currentTwistDownElement, CStr63 &theName, Boolean &foundIt);
-
- void TTwistDownDocument::GetVisibleTwistDownElementByIndex(short desiredIndex, TTwistDownElement* startingTwistDownElement,
- TTwistDownElement** currentTwistDownElement, short &elementCounter);
-
- virtual Boolean TTwistDownDocument::GetObjectProperty(CAEDesc& thePropertyValue,DescType whichProperty,
- const CAEDesc& desiredType);
-
- virtual void TTwistDownDocument::GetSetPropertyInfo(DescType whichProperty,CommandNumber& cmdNum,Boolean& canUndo,
- Boolean& causesChange,TCommandHandler* &theContext);
-
- virtual void TTwistDownDocument::SetObjectProperty(const CAEDesc& thePropertyValue,DescType whichProperty);
-
- virtual MScriptableObject* TTwistDownDocument::GetIndContainedObject(DescType desiredType,long index);
-
- virtual MScriptableObject* TTwistDownDocument::GetContainedObject(DescType desiredType,DescType selectionForm,
- const CAEDesc& selectionData);
-
- virtual long TTwistDownDocument::CountContainedObjects(DescType desiredType);
- };
-
- #endif
-